package com.softer.wxzj.controller;

import com.github.pagehelper.PageInfo;
import com.softer.wxzj.common.aop.annotation.LogRecord;
import com.softer.wxzj.common.aop.enums.LogOperationType;
import com.softer.wxzj.common.aop.enums.LogOperationUnit;
import com.softer.wxzj.common.entity.CommonResult;
import com.softer.wxzj.common.entity.Page;
import com.softer.wxzj.entity.AccInterestConfig;
import com.softer.wxzj.service.AccInterestConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 结息配置
 * @author zcz
 * @date 2019/08/01
 */
@RestController
@RequestMapping("/accInterestConfig")
public class AccInterestConfigController {
    @Autowired
    private AccInterestConfigService accInterestConfigService;

    /**
     * 新增结息配置
     * @param accInterestConfig
     * @return
     */
    @RequestMapping("/add")
    @LogRecord(description = "新增结息配置", operationUnit = LogOperationUnit.ACC_INTEREST_CONFIG, operationType = LogOperationType.INSERT)
    public CommonResult add(AccInterestConfig accInterestConfig) {
        return accInterestConfigService.insert(accInterestConfig);
    }

    /**
     * 查询结息配置详情
     * @param id
     * @return
     */
    @RequestMapping("/getInfo")
    @LogRecord(description = "查询结息配置详情", operationUnit = LogOperationUnit.ACC_INTEREST_CONFIG, operationType = LogOperationType.SELECT)
    public AccInterestConfig getInfo(@RequestParam("id") String id) {
        return accInterestConfigService.getInfo(id);
    }

    /**
     * 修改结息配置
     * @param accInterestConfig
     * @return
     */
    @RequestMapping("/update")
    @LogRecord(description = "修改结息配置", operationUnit = LogOperationUnit.ACC_INTEREST_CONFIG, operationType = LogOperationType.UPDATE)
    public CommonResult update(AccInterestConfig accInterestConfig) {
        return accInterestConfigService.update(accInterestConfig);
    }

    /**
     * 删除结息配置
     * @param id
     * @return
     */
    @RequestMapping("/delete")
    @LogRecord(description = "删除结息配置", operationUnit = LogOperationUnit.ACC_INTEREST_CONFIG, operationType = LogOperationType.DELETE)
    public CommonResult delete(@RequestParam("id") String id) {
        return accInterestConfigService.delete(id);
    }

    /**
     * 查询结息配置列表
     * @param page
     * @param accInterestConfig
     * @return
     */
    @RequestMapping("/getList")
    @LogRecord(description = "查询结息配置列表", operationUnit = LogOperationUnit.ACC_RATE_INFO, operationType = LogOperationType.SELECT)
    public PageInfo<AccInterestConfig> getList(Page page, AccInterestConfig accInterestConfig) {
        return accInterestConfigService.getList(page, accInterestConfig);
    }

}
